/**
 * @author LKQ
 * @date 2022/3/4 13:16
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] arr = {1,2,3,4,5,6,7};
        solution.numOfSubarrays(arr);
    }
    public int numOfSubarrays(int[] arr) {
        int cnt = 0, n = arr.length, MOD = 1_000_000_007;
        int[] dp = new int[n + 1];
        for (int i = 1; i < n + 1; i++) {
            dp[i] = dp[i-1] + arr[i-1];
        }
        for (int i = 0; i < n; i++) {
            if (arr[i] % 2 == 1) {
                cnt++;
            }
            for (int j = i+1; j < n; j++) {
                if ((dp[j + 1] - dp[i]) % 2 ==1) {
                    cnt++;
                    cnt = cnt % MOD;
                }
            }
        }
        return cnt;
    }
}
